//
//  SecondViewController.m
//  UI14_HomeWork_豆瓣
//
//  Created by Bodi on 16/6/23.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "SecondViewController.h"
#import "ActivityViewController.h"
#import "ActivityModel.h"
#import "UIImageView+WebCache.h"
@interface SecondViewController ()

@end

@implementation SecondViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    [self creatSubView];self.navigationController.navigationBar.translucent = NO;
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.navigationItem.title = self.actionModel.title;
}
- (void)creatSubView{
    UIScrollView *scroView =[[UIScrollView alloc]init];
    scroView.frame = CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds));
    scroView.contentSize = CGSizeMake(CGRectGetWidth(self.view.bounds),2000 );
    [self.view addSubview:scroView];
    
    UIImage *image2 = [UIImage imageNamed:@"icon_date_blue@2x.png"];
    UIImageView *activitylconView2 = [[UIImageView alloc]initWithImage:image2];
    activitylconView2.frame = CGRectMake(190, 105, 19, 19);
    [scroView addSubview:activitylconView2];
    [activitylconView2 release];
    
    UIImage *image3 = [UIImage imageNamed:@"icon_catalog_blue@2x.png"];
    UIImageView *activitylconView3 = [[UIImageView alloc]initWithImage:image3];
    activitylconView3.frame = CGRectMake(190, 183, 19, 19);
    [scroView addSubview:activitylconView3];
    [activitylconView3 release];
    
    UIImage *image4 = [UIImage imageNamed:@"icon_spot_blue@2x.png"];
    UIImageView *activitylconView4 = [[UIImageView alloc]initWithImage:image4];
    activitylconView4.frame = CGRectMake(190, 213, 19, 19);
    [scroView addSubview:activitylconView4];
    [activitylconView4 release];
    
    
    UIImage *image5 = [UIImage imageNamed:@"icon_sponsor_blue@2x.png"];
    UIImageView *activitylconView5 = [[UIImageView alloc]initWithImage:image5];
    activitylconView5.frame = CGRectMake(190, 143, 19, 19);
    [scroView addSubview:activitylconView5];
    [activitylconView5 release];
    
    
    NSURL *url = [NSURL URLWithString:self.actionModel.image];

    UIImageView *activitylconView = [[UIImageView alloc]init];
    [activitylconView sd_setImageWithURL:url];
    activitylconView.frame = CGRectMake(10, 100, 160, 200);
    [scroView addSubview:activitylconView];
    [activitylconView release];
    
    
    

   UILabel *titleLaber = [[UILabel alloc]initWithFrame:CGRectMake(10, 10,390 , 80)];
    titleLaber.text = self.actionModel.title;
    titleLaber.numberOfLines = 2;
    titleLaber.font = [UIFont boldSystemFontOfSize:24.0f];
    [scroView addSubview:titleLaber];
    
    UILabel *timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(210, 105, 200, 20) ];
    timeLabel.text = [NSString stringWithFormat:@"%@ -- %@", self.actionModel.begin_time, self.actionModel.end_time];
    timeLabel.font = [UIFont systemFontOfSize:8.0f];
    [scroView addSubview:timeLabel];

    
    
    UILabel *ownerLabel = [[UILabel alloc]initWithFrame:CGRectMake(210, 143, 200, 20)];
    ownerLabel.text = [self.actionModel.owner objectForKey:@"name"];
    ownerLabel.font = [UIFont systemFontOfSize:13.0f];
    [scroView addSubview:ownerLabel];
    
    
    UILabel *categoryLabel = [[UILabel alloc]initWithFrame:CGRectMake(210, 181, 200, 20)];
    categoryLabel.text = [NSString stringWithFormat:@"类型: %@", self.actionModel.category_name];
    categoryLabel.font = [UIFont systemFontOfSize:13.0f];
    [scroView addSubview:categoryLabel];
    
    
    UILabel *addressLabel = [[UILabel alloc]initWithFrame:CGRectMake(210, 210, 200, 40) ];
    
    addressLabel.text = self.actionModel.address;
    addressLabel.numberOfLines = 2;
    addressLabel.font = [UIFont systemFontOfSize:13.0f];
    [scroView addSubview:addressLabel];
    
    
    UILabel *view = [[UILabel alloc]initWithFrame:CGRectMake(10, 320, 100, 50) ];
    view.text =@"活动介绍";
    view.font = [UIFont boldSystemFontOfSize:25.0f];
    [scroView addSubview:view];
    
    
    UILabel *contentView = [[UILabel alloc]initWithFrame:CGRectMake(10, 400, 400, 1000) ];
   contentView.text = self.actionModel.content;
    //contentView.text = @"fkapfla";
    contentView.font = [UIFont systemFontOfSize:17.0f];
    contentView.numberOfLines = 0;
    [scroView addSubview:contentView];

}






- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
